package com.easyj.admin.activiti.config;

import org.activiti.api.process.runtime.events.ProcessCreatedEvent;
import org.activiti.api.process.runtime.events.ProcessStartedEvent;
import org.activiti.api.process.runtime.events.listener.ProcessRuntimeEventListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * 
 * @author hjf
 *   全局process事件监听，可据需要监听process的创建、启动、挂起等状态
 */
@Configuration
public class ProcessRuntimeEventListenerConfig {

	@Bean
    public ProcessRuntimeEventListener<ProcessCreatedEvent> ProcessCreatedListener() {
        return ProcessCreated -> {
        	//ProcessCreated.getEntity().getInitiator()
            // ProcessCreated.getEntity().getProcessDefinitionKey();
        };
    }

    @Bean
    public ProcessRuntimeEventListener<ProcessStartedEvent> ProcessStartedListener() {
        return ProcessStarted -> {
        	//ProcessCreated.getEntity().getInitiator()
            // ProcessCreated.getEntity().getProcessDefinitionKey();
        };
    }
}
